/** @file               sw_rbuf.h
 *  @copyright          Copyright (C) 2006-2026 flyfish (tenggui_fu@126.com)
 *  @brief              This file is part of the swallow library
 *  @author             $Author: flyfish $
 *  @version            $Rev: 385 $
 *  @date               $Date: 2016-12-22 00:12:05 +0800 (周四, 22 12月 2016) $
 */
#ifndef __SW_RBUF_H__
#define __SW_RBUF_H__

#ifdef __cplusplus
extern "C" {
#endif

typedef SW_VOID *SW_RBUF;
#define SW_INVALID_RBUF NULL

SW_API SW_RET SW_InitRbufAPI(SW_VOID);
SW_API SW_RET SW_RunRbufAPI(SW_VOID);
SW_API SW_RET SW_StopRbufAPI(SW_VOID);
SW_API SW_RET SW_ExitRbufAPI(SW_VOID);
SW_API SW_RBUF SW_CreateRbuf(SW_UINT32 itemSize, SW_UINT32 itemMax);
SW_API SW_RET SW_DeleteRbuf(SW_RBUF rbuf);
SW_API SW_RET SW_ClearRbuf(SW_RBUF rbuf);
SW_API SW_RET SW_ReadRbuf(SW_RBUF rbuf, SW_VOID *pItem);
SW_API SW_RET SW_TryReadRbuf(SW_RBUF rbuf, SW_VOID *pItem);
SW_API SW_RET SW_TimeReadRbuf(SW_RBUF rbuf, SW_VOID *pItem, SW_UINT32 msec);
SW_API SW_RET SW_PeerRbuf(SW_RBUF rbuf, SW_VOID *pItem, SW_UINT32 index);
SW_API SW_RET SW_TryPeerRbuf(SW_RBUF rbuf, SW_VOID *pItem, SW_UINT32 index);
SW_API SW_RET SW_TimePeerRbuf(SW_RBUF rbuf, SW_VOID *pItem, SW_UINT32 msec, SW_UINT32 index);
SW_API SW_RET SW_ModifyRbuf(SW_RBUF rbuf, const SW_VOID *pItem, SW_UINT32 index);
SW_API SW_RET SW_WriteRbuf(SW_RBUF rbuf, const SW_VOID *pItem);
SW_API SW_RET SW_TryWriteRbuf(SW_RBUF rbuf, const SW_VOID *pItem);
SW_API SW_RET SW_TimeWriteRbuf(SW_RBUF rbuf, const SW_VOID *pItem, SW_UINT32 msec);
SW_API SW_RET SW_ForceWriteRbuf(SW_RBUF rbuf, const SW_VOID *pItem);
SW_API SW_UINT32 SW_GetRbufItemCount(SW_RBUF rbuf);
SW_API SW_BOOL SW_IsRbufFull(SW_RBUF rbuf);
SW_API SW_BOOL SW_IsRbufEmpty(SW_RBUF rbuf);

#ifdef __cplusplus
}
#endif

#endif

